@extends('backend::layout')
@section('title',trans($page_title))
@push('styles')
    <link rel="stylesheet" type="text/css" href="{{asset(config('view.backend.theme.theme2').'/css/wizard.css')}}">
    <link href="{{asset(config('view.plugin').'/layui/layui_ext/cascader/cascader.css')}}" rel="stylesheet">
@endpush
@section('content')
    <div class="row"><div class="col-12 pb-2">
            @component('backend::component.form.button')
                @slot('title') {{config('shop.zone')[1]}} @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('size') md @endslot
                @if($zone == 1)
                     @slot('color') danger @endslot
                @endif
                @slot('icon') hcl-goods-add1 @endslot
                @slot('href') {{route('b_ShopGoods_create',['zone'=>1])}} @endslot
            @endcomponent
            @component('backend::component.form.button')
                    @slot('title') {{config('shop.zone')[2]}} @endslot
                    @slot('elem') a @endslot
                    @slot('btn') btn @endslot
                     @slot('size') md @endslot
                    @if($zone == 2)
                        @slot('color') danger @endslot
                    @endif
                    @slot('icon') hcl-goods-add1 @endslot
                    @slot('href') {{route('b_ShopGoods_create',['zone'=>2])}} @endslot
            @endcomponent
            @component('backend::component.form.button')
                @slot('title') {{config('shop.zone')[3]}} @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                 @slot('size') md @endslot
                @if($zone == 3)
                    @slot('color') danger @endslot
                @endif
                @slot('icon') hcl-goods-add1 @endslot
                @slot('href') {{route('b_ShopGoods_create',['zone'=>3])}} @endslot
            @endcomponent
        </div></div>

    @component('backend::component.form.form')
        @slot('page_title') {{$page_title}} @endslot
        @slot('formId') add-goods @endslot
        @slot('attr') class = wizard @endslot
        @slot('action') {{route('b_ShopGoods_create',['zone'=>$zone])}} @endslot
        @component('backend::component.form.form-steps',['steps'=>[
                ['title'=>'商品信息','href'=>'goods-base','icon'=>'hcl-goods','is_show'=>true],
                ['title'=>'商品价格','href'=>'goods-price','icon'=>'hcl-coin','is_show'=>true],
                ['title'=>'商品属性','href'=>'goods-attr','icon'=>'hcl-cs','is_show'=>true],
                ['title'=>'商品详情','href'=>'goods-detail','icon'=>'hcl-wangye','is_show'=>true],
            ]])
        @endcomponent
        @include('backend::shop.goods.add_section.goods_base',['id'=>'goods-base'])
        @include('backend::shop.goods.add_section.goods_price',['id'=>'goods-price'])
        @include('backend::shop.goods.add_section.goods_attr',['id'=>'goods-attr'])
        @include('backend::shop.goods.add_section.goods_detail',['id'=>'goods-detail'])

        @slot('buttons')
            @slot('class') justify-content-end @endslot
            @component('backend::component.form.button')
                @slot('title') 上一步 @endslot
                @slot('elem') a @endslot
                @slot('href') #previous @endslot
                @slot('btn') btn @endslot
                @slot('size') sm @endslot
                @slot('class') d-none step-btn mr-2 @endslot
                @slot('color') danger @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 下一步 @endslot
                @slot('elem') a @endslot
                @slot('btn') btn @endslot
                @slot('class') step-btn mr-2 @endslot
                @slot('href') #next @endslot
                @slot('size') sm @endslot
                @slot('color') danger @endslot
            @endcomponent

            @component('backend::component.form.button')
                @slot('title') 提交 @endslot
                @slot('size') sm @endslot
                @slot('params') {"formId":"#add-goods"} @endslot
                @slot('class') btn-min-width ajax-form d-none @endslot
            @endcomponent

        @endslot
    @endcomponent
@endsection
@include('backend::component.upload.upload_js')
@push('scripts')
    <script src="{{asset(config('view.backend.theme.theme2').'/js/shop.js')}}"></script>
    <script src="{{asset(config('view.backend.theme.theme2').'/js/modules/wizard-steps.js')}}"></script>
    <script>
        layui.use(['jquery','layer','cascader'], function(){
            var $ = layui.jquery;
            var cascader = layui.cascader;
            selectParentAction();
            goodsTypeInit($('#goods_type'));

            function selectParentAction() {
                var data = $('#action_parent').data('parents');
                cascader({
                    elem: "#action_parent",
                    data: data,
                    triggerType: "change",
                    // showLastLevels:true,
                    value: ["0"],
                    changeOnSelect:true,
                    success:function (valData) {
                        $('#parent-value').val(valData);
                    }
                });
            }
        });
    </script>
@endpush
